from rest_framework import serializers
from frame_server.serializers import BaseSerializer as BSerializer
from django.contrib.auth import get_user_model

User = get_user_model()

class BaseSerializer(BSerializer):
    id = serializers.CharField()
    roleId = serializers.CharField()
    roleName = serializers.CharField()
    deptId = serializers.CharField()
    deptName = serializers.CharField()
    tenantId = serializers.CharField(source="tenantId_id", required=False, allow_null=True)
    createUserId = serializers.CharField(source="createUserId_id", required=False, allow_null=True)
    updateUserId = serializers.CharField(source="updateUserId_id", required=False, allow_null=True)

    class Meta:
        model = User

# 系统管理-用户管理-表格数据
class ListSerializer(BaseSerializer):
    class Meta(BaseSerializer.Meta):
        exclude = ['password']

# 系统管理-用户管理-用户详情
class DetailSerializer(BaseSerializer):
    class Meta(BaseSerializer.Meta):
        exclude = ['password']

# 登陆成功后返回的用户信息
class LoginInfoSerializer(BaseSerializer):
    class Meta(BaseSerializer.Meta):
        exclude = ['password']

# 用户信息
class InfoSerializer(BaseSerializer):
    class Meta(BaseSerializer.Meta):
        exclude = ['password']